//
/*
 * @Description: 日志 - 操作日志
 * @Author: Rfan
 * @Date: 2022-09-20 15:34:08
 * @LastEditTime: 2023-01-30 11:38:12
 */

import { Key } from 'react';
import { logRequest } from '@/utils/request';
import { IPageQuery } from '@/interfaces/global';

// 列表请求参数
export interface ILoginLogParams {
  description?: string;
  id?: number;
  ip?: string;
  operateTime?: string;
  operateTimeList?: any[];
  status?: number;
  type?: number;
  userId?: number;
  userName?: string;
}

// 列表返回数据
export interface IOperateLogRes {
  ip: string;
  operateTime: number;
  description: string;
  id: number;
  type: number;
  userName: string;
  userId: null;
  status: number;
}

// 分页查询列表
export function fetchLoginListByPage(data: IPageQuery<ILoginLogParams>) {
  return logRequest({
    url: `/sys-login-log/page`,
    method: 'post',
    data
  });
}

// 删除日志
export function deleteLoginLog(id: Key) {
  return logRequest({
    url: `/sys-login-log/${id}`,
    method: 'delete'
  });
}
